<?php
/* TODO: Add code here */
require('config/globalconfig.php');
?>
<?php
include_once('classes/user_sphinx_search.php');
include_once('classes/user_product.php');
include_once('classes/user_catalogue.php');
include_once('classes/user_property.php');
include_once('classes/user_faq.php');
//user_common::writeLog('insert',0);
$objProduct = new user_product($objConnection);
$objProperty = new user_property($objConnection);
$objFAQ = new user_faq($objConnection);
//$_SESSION[user_common::SES_C_USERINFO] = "user";
//$_SESSION[user_common::SES_C_USERINFO]["active"]=1;
//$objProduct->insert('1','1','1','1');

if($_pgR['act'] == user_product::ACT_CHANGE_PAGE)
{
	$intPage = $_pgR['p'];
	
	$outPutHTML =  $objProduct->getListProduct($intPage);
	echo user_common::convertToXML($strMessageHeader, array('rs','inf'), array(1,$outPutHTML),array(0,1));
	return ;
}

//output chi tiet san pham: tinh nang, cau hoi faq
if(isset($_pgR['product']) && isset($_pgR['cat']))
{
	//$product_id = $_pgR['product'];
	//$cat_id = $_pgR['cat'];
	//$strHTMLProduct = $objProduct->outputHTMLProductDetail($product_id,$cat_id);
}
if(isset($_pgR['sct']))
{
	$keyword = $_pgR['sct'];
	
	if(!$_pgR['cat'])
	{
		$_pgR['cat']=0;
	}
	$indexName = 't_faq';
	$user_sphinx = new user_sphinx_search($objConnection,$indexName);
	$strFilter = 'content_id ='.$_pgR['product'].' or content_id ='.$_pgR['cat'];
	$arrFAQ = $user_sphinx->search_for_keyword($keyword,0,user_sphinx_search::NUM_RECORD_FOR_TABLE,$strFilter);
	//print_r($arrFAQ);
	$arrResultFAQ= $objFAQ->getFaqByIDs($arrFAQ);
	//print_r($arrFAQ);
	//echo '<br>';
	//print_r($arrResult);
	//xuất chuỗi html search
	$strHTMLFAQ = $objFAQ->outputHTMLSearch($arrResultFAQ,$keyword);
	
	$indexName = 't_property';
	$strFilter = 'content_id ='.$_pgR['product'].' or content_id ='.$_pgR['cat'];
	$user_sphinx = new user_sphinx_search($objConnection,$indexName);
	$arrProperty = $user_sphinx->search_for_keyword($keyword,0,user_sphinx_search::NUM_RECORD_FOR_TABLE,$strFilter);
	$arrResultFAQ= $objProperty->getPropertyByIDs($arrProperty);
	//print_r($arrProperty);
	$strHTMLProperty = $objProperty->outputPropertySearchDetail($arrProperty,$keyword);
}
// echo 'callcenter';
// user_common::writeLog("anc",1);


include_once('include/_header.inc');
include_once('include/_menu.inc');
include_once('include/_search_box_detail.inc');
?>
<script type="text/javascript" src="<?php echo $_objSystem->locateJs('user_admin_product.js');?>"></script>
<script type="text/javascript" src="<?php echo $_objSystem->locateJs('ajaxupload.js');?>"></script>


	
<!--Begin Form Input -->
<input type="hidden" id="adddocmode" name="adddocmode" value="1<?php //echo $intMode;?>" />
<input type="hidden" id="txtPage" name="txtPage" value="<?php echo $_pgR["p"]?$intPage:1;?>" />
<?php 
$arrProduct = $objProduct->getProductByID($_pgR['product']);
echo '<br><h2 align="left" ><a href="product_detail.php?product='.$arrProduct['product_id'].'&cat='.$arrProduct['cat_id'].'">Sản phẩm: ' .$arrProduct['name'].'</a></h2>';

//output chi tiet san pham
echo $strHTMLFAQ;
echo $strHTMLProperty;
?>
		<!--div>
			<div style="float:left;width:49%;">
				<table class="tbl-list" style="width:100%">
					<thead>
						<td class="lastCell" colspan="2">Tính năng riêng</td>
					</thead>
					<tr class="even">
					<td>Tinh nang</td>
							<td class="lastCell"> gia tri tinh nang</td>
					</tr>
					 <tr  class="odd">
					<td>Tinh nang</td>
							<td class="lastCell"> gia tri tinh nang</td>
					</tr>
				</table>
			</div>
			<div style="float:right;width:49%; ">
				<table  class="tbl-list" style="width:100%">
					<thead>
					<td colspan="2" class="lastCell">Tính năng riêng chung</td>
				</thead>
					<tr class="even">
						<td>Tinh nang</td>
						<td class="lastCell"> gia tri tinh nang</td>
					</tr>
					 <tr  class="odd">
						<td>Tinh nang</td>
						<td class="lastCell"> gia tri tinh nang</td>
					</tr>
				</table>
			</div>
       </div>
       
        <div style="padding-top:100px">
			<div style="float:left;width:49%;">
				<table class="tbl-list" style="width:100%">
				<thead>
					<td class="lastCell">Câu hỏi riêng</td>
				</thead>
				<tr class="even">
				<td class="lastCell">Tinh nang</td>
		               
				</tr>
				 <tr  class="odd">
				<td class="lastCell">Tinh nang</td>
		         
				</tr>
	       
			</table>
			</div>
			<div style="float:right;width:49%;">
				<table  class="tbl-list" style="width:100%">
				<thead>
						<td class="lastCell">Câu hỏi chung</td>
				</thead>
				<tr class="even">
				<td class="lastCell">Câu hỏi</td>
		         
				</tr>
				 <tr  class="odd">
				<td class="lastCell">Câu đáp</td>
		           
				</tr>
		       
			   <tr class="even">
				<td class="lastCell">Câu hỏi</td>
		         
				</tr>
				 <tr  class="odd">
				<td class="lastCell">Câu đáp</td>
		           
				</tr> <tr class="even">
				<td  class="lastCell">Câu hỏi</td>
		         
				</tr>
				 <tr  class="odd">
				<td  class="lastCell">Câu đáp</td>
		           
				</tr> <tr class="even">
				<td  class="lastCell">Câu hỏi</td>
		         
				</tr>
				 <tr  class="odd">
				<td  class="lastCell">Câu đáp</td>
		           
				</tr>
				</table>
			</div>
       </div-->


<?php 
//footer
include_once('include/_footer.inc');
?>